home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 551-575 / disk_570 / gadtoolsbox / source / source.lha / Coords.c < prev    next >
C/C++ Source or Header  |  1991-11-04  |  2KB  |  79 lines

  1. /*-- AutoRev header do NOT edit!
  2. *
  3. *   Program         :   Coords.c
  4. *   Copyright       :   © Copyright 1991 Jaba Development
  5. *   Author          :   Jan van den Baard.
  6. *   Creation Date   :   15-Oct-91
  7. *   Current version :   1.00
  8. *   Translator      :   DICE v2.6
  9. *
  10. *   REVISION HISTORY
  11. *
  12. *   Date          Version         Comment
  13. *   ---------     -------         ------------------------------------------
  14. *   15-Oct-91     1.00            Coordinates routines.
  15. *
  16. *-- REV_END --*/
  17.  
  18. #include "GTEd.h"
  19. #include "Protos.h"
  20.  
  21. extern struct Screen        *MainScreen;
  22. extern struct IntuiText      Topaz80;
  23.  
  24. UBYTE                        CrdBuf[40];
  25. struct IntuiText             CrdTxt = {
  26.     0, 1, JAM2, 0, 1, &Topaz80, CrdBuf, 0l };
  27.  
  28. /*
  29.  * --- Set the screen title by  drawing a rectangle
  30.  * --- in the screen it's rastport and rendering the
  31.  * --- text in this rectangle so the title can be read
  32.  * --- when a window overlaps it.
  33.  */
  34. void SetTitle( UBYTE *title )
  35. {
  36.     struct RastPort *rp = &MainScreen->RastPort;
  37.     WORD             ysize;
  38.  
  39.     ysize = MainScreen->WBorTop + rp->TxHeight;
  40.  
  41.     SetAPen( rp, 1l );
  42.     SetDrMd( rp, JAM1 );
  43.  
  44.     RectFill( rp, 0, 0, MainScreen->Width - 1, ysize );
  45.  
  46.     SetAPen( rp, 0l );
  47.     SetBPen( rp, 1l );
  48.     SetDrMd( rp, JAM2 );
  49.  
  50.     if ( title ) {
  51.         Move( rp, 1, rp->TxBaseline + 1 );
  52.         Text( rp, title, strlen( title ));
  53.     }
  54. }
  55.  
  56. /*
  57.  * --- Update the coordinates on the screen.
  58.  */
  59. void UpdateCoords( long how, WORD l, WORD t, WORD w, WORD h )
  60. {
  61.     struct RastPort     *rp = &MainScreen->RastPort;
  62.     struct IntuiText     it;
  63.     WORD                 mx, my;
  64.  
  65.     if ( how == 0l ) {
  66.         GetMouseXY( &mx, &my );
  67.         sprintf( CrdBuf, "x=%-5ld y=%-5ld", mx, my );
  68.         CrdTxt.LeftEdge = MainScreen->Width - 157;
  69.     } else if ( how == 1l ) {
  70.         sprintf( CrdBuf, "l=%-5ld t=%-5ld w=%-5ld h=%-5ld", l, t, w, h );
  71.         CrdTxt.LeftEdge = 1;
  72.     } else if ( how == 2l ) {
  73.         sprintf( CrdBuf, "l=%-5ld t=%-5ld", l, t );
  74.         CrdTxt.LeftEdge = 1;
  75.     }
  76.  
  77.     PrintIText( rp, &CrdTxt, 0l, 0l );
  78. }
  79.